package com.yy.tankgame;
import java.awt.Color;
import java.awt.Graphics;

/**
 * +draw()方法：live=true and step<length时，绘制不同直径的圆
 * +对TankClient的引用以及Explode构造函数
 *@author Yun
 *@date 2014-5-4 下午10:38:42
 *@version 0.1
 */

public class Explode {
	int x, y ;
	private boolean live = true;
	
	private TankClient tc;
	
	int[] diameter = {4, 7, 12, 18, 24, 32, 49, 30, 13, 5};
	int step = 0;
	
	public Explode(int x, int y, TankClient tc){
		this.x = x;
		this.y = y;
		this.tc = tc;
	}
	
	public void draw(Graphics g){
		if(!live) {
			tc.explode.remove(this);
			return;
		}
		if(step == diameter.length){
			live = false;
			step = 0;
			return;
		}
		Color c = g.getColor();
		g.setColor(Color.ORANGE);
		g.fillOval(x, y, diameter[step], diameter[step]);
		g.setColor(c);
		step ++;
	}

}
